#include "window.h"
#include "enib.h"
#include "lumiere.h"
#include "plan.h"
#include "vent.h"
#include "soucoupe.h"
#include "nuages.h"
#include "pointeur.h"

int main(int argc, char**argv)
{
  Window *win = WindowCreator::createWindow("toto",0,0,800,600,&argc,argv);
  //Lumiere
  Lumiere lum;
  lum.setPosition(-10,3,10);
  lum.setDiffuse(1.0,0.81,0.43,1.0);
  lum.setCutoff(180.0);


Lumiere lum2;
lum2.setPosition(0.0,10,0.0);
lum2.setDiffuse(1.0,0.81,0.43,1.0);
lum2.setCutoff(180.0);


  //l'enib
  Batiment bat;
  Sol sol;
  Background back;

  //le vent
  Vent vent;

  //les nuages
  Nuages nuages(&vent);

  //Les pointeurs
  string * s = new string("Entree");
  Pointeur p1(0.2,s);
  p1.setPosition(0.2,1.65,0.05);

  s = new string("Acces aux etages");
  Pointeur p2(0.2,s);
  p2.setPosition(4.5,1.45,0.05);

  s = new string("Parking");
  Pointeur p3(0.2,s);
  p3.setPosition(-9.0,3.0,0.05);

  //la soucoupe
  Soucoupe soucoupe(&vent);
  Soucoupe soucoupe2(&vent);
  soucoupe.setPilote("pilote.png");
  //la borne d'incendie
  Plan borne(0.5,0.5,"tex_borne_incendie.png");
  borne.setPosition(3.2,0.25,0.6);
  (borne.getTexture())->setModePlaquage(GL_REPLACE);

  //les plots
  Plan plot1(0.25,0.25,"tex_plot.png");
  plot1.setPosition(-0.2,0.125,1.35);
  (plot1.getTexture())->setModePlaquage(GL_REPLACE);

  Plan plot2(0.25,0.25,"tex_plot.png");
  plot2.setPosition(-2.6,0.125,1.3);
  (plot2.getTexture())->setModePlaquage(GL_REPLACE);

  Plan plot3(0.25,0.25,"tex_plot.png");
  plot3.setPosition(-4.9,0.125,1.18);
  (plot3.getTexture())->setModePlaquage(GL_REPLACE);

  Plan plot4(0.25,0.25,"tex_plot.png");
  plot4.setPosition(-7.05,0.125,1.12);
  (plot4.getTexture())->setModePlaquage(GL_REPLACE);

  Plan plot5(0.25,0.25,"tex_plot.png");
  plot5.setPosition(-9.0,0.125,0.95);
  (plot5.getTexture())->setModePlaquage(GL_REPLACE);


  //le panneau de la rue
  Plan panneau(2.0,2.0,"tex_panneau.png");
  panneau.setPosition(-7.9,1.0,1.3);
  (panneau.getTexture())->setModePlaquage(GL_REPLACE);

  // la scene
  Scene scene;
  //scene.addObjet(&enib);
  scene.addObjet(&borne);
  scene.addObjet(&plot1);
  scene.addObjet(&plot2);
  scene.addObjet(&plot3);
  scene.addObjet(&plot4);
  scene.addObjet(&plot5);
  scene.addObjet(&panneau);
  scene.addObjet(&bat);
  scene.addObjet(&sol);
  scene.addObjet(&back);
  scene.addObjet(&soucoupe);
//  scene.addObjet(&nuages);
  scene.addObjet(&p1);
  scene.addObjet(&p2);
  scene.addObjet(&p3);
  scene.addObjet(&soucoupe2);
  scene.addLumiere(&lum);
  scene.addLumiere(&lum2);
  scene.addTimerListener(&vent);
  scene.addTimerListener(&soucoupe);
  scene.addTimerListener(&soucoupe2);
//  scene.addTimerListener(&nuages);
  //scene.addKeyboardListener(&enib);
  scene.setPointObservation(0.2932,3.7/*4.5498*/,0.0);
  scene.setCameraPosition(-6,5,10);
  scene.setCameraVerticale(0.0643, 0.9979, 0.0);

  //la boucle ...
  win->setScene(&scene);
  win->mainLoop();

  return 0;
}
